package com.example.sht37.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.sht37.entity.Emp;
import com.example.sht37.service.EmpService;
import com.example.sht37.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/emp")
@Api(tags="员工接口类")
public class EmpController {
    @Autowired
    private EmpService empService;

        @PostMapping("getAll/{currentPage}/{pageSize}")
        @ApiOperation(value = "分页查询员工信息",tags = "getAll")
        public Result<Page<Emp>> getAll( @ApiParam(value = "当前页码")@PathVariable Integer currentPage,
                                        @ApiParam(value = "每页个数") @PathVariable Integer pageSize){
            return empService.listByPage(currentPage,pageSize);

        }
    @DeleteMapping("delEmp/{empno}")
    @ApiOperation(value = "根据编号删除员工")
    public boolean delEmp(@PathVariable Integer empno){
        System.out.println("empno="+empno);
        return empService.removeById(empno);
    }
    }

